﻿/// <summary>
/// 
/// </summary>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using Byo.Win32;

namespace CmdEx
{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public partial class MainForm : Form
    {
        private System.Diagnostics.ProcessStartInfo _procStartInfo;
        
        public MainForm()
        {
            InitializeComponent();
            Helper.HideFromAltTab(this.Handle);
        }

        protected void BtnExecuteClick(object sender, EventArgs e)
        {
        	try
            {
                 // create the ProcessStartInfo using "cmd" as the program to be run,
                 // and "/c " as the parameters.
                 // Incidentally, /c tells cmd that we want it to execute the command that follows,
                 // and then exit.
        	    System.Diagnostics.ProcessStartInfo procStartInfo =
        	    	new System.Diagnostics.ProcessStartInfo("cmd", "/c " + "");
        	
        	    // The following commands are needed to redirect the standard output.
        	    // This means that it will be redirected to the Process.StandardOutput StreamReader.
        	    procStartInfo.RedirectStandardOutput = true;
        	    procStartInfo.UseShellExecute = false;
        	    // Do not create the black window.
        	    procStartInfo.CreateNoWindow = true;
        	    // Now we create a process, assign its ProcessStartInfo and start it
        	    System.Diagnostics.Process proc = new System.Diagnostics.Process();
			    proc.StartInfo = procStartInfo;
			    proc.Start();
			    // Get the output into a string
			    string result = proc.StandardOutput.ReadToEnd();
			    // Display the command output.
			    //rbMain.Text = rbMain.Text + " -> " + result;

		    }
		    catch (Exception objException)
		    {
		    	// Log the exception
		    }

		}
			
		
		void MainFormLoad(object sender, EventArgs e)
		{
		    //InitializeWinPosAndSize();
		}
		
		private void InitializeWinPosAndSize()
		{
            this.Top = 0; // -windowHeight;
		    this.Left = 0;
		    this.Width = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height = 200;
		    this.Show();
		}

        

	}
}
